<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Alejandro Casas
 * Date: 1/28/13
 * Time: 7:26 PM
 * To change this template use File | Settings | File Templates.
 */
require_once 'DataLoader.php';

include_once('httpful-0.2.0.phar');
class CommonWS
{

    private $client;



    public function __construct() {
        $this->client = $_SESSION['base_server_url'];
    }




	public function GetUserBasicInfo($mail)
	{
        $uri=$this->client."GetUserBasicInfo/".$mail;
        $r = \Httpful\Request::get($uri)->sendIt();
        return $r;
    }


	
	public function SetStatus($mail,$status)
	{
        $uri=$this->client."SetStatus/".$mail."/".$status;
        $r = \Httpful\Request::get($uri)->sendIt();
        return $r;
    }


	public function GetUserReviews($mail)
	{
        $uri=$this->client."GetUserReviews/".$mail;
        $r = \Httpful\Request::get($uri)->sendIt();
        return $r;
    }

	
	public function ReportUser($mailReporter,$mailReported,$message)
	{
        $uri=$this->client."ReportUser/".$mailReporter."/".$mailReported."/".$message;
        $r = \Httpful\Request::get($uri)->sendIt();
        return $r;
    }
	
	public function Follow($mailFollower,$mailFollowed)
	{
        $uri=$this->client."Follow/".$mailFollower."/".$mailFollowed;
        $r = \Httpful\Request::get($uri)->sendIt();
        return $r;
    }
	
	public function Unfollow($mailFollower,$mailFollowed)
	{
        $uri=$this->client."Unfollow/".$mailFollower."/".$mailFollowed;
        $r = \Httpful\Request::get($uri)->sendIt();
        return $r;
    }


	public function WriteReview($mailFrom,$mailTo,$sport,$calification,$title,$message,$nameFrom)
	{
        $uri=$this->client."WriteReview/".$mailFrom."/".$mailTo."/".$sport."/".$calification."/".$title."/".$message."/".$nameFrom;
        $r = \Httpful\Request::get($uri)->sendIt();
        return $r;
    }

	
	public function GetFollowers($mail)
	{
        $uri=$this->client."GetFollowers/".$mail;
        $r = \Httpful\Request::get($uri)->sendIt();
        return $r;
    }
	

	public function VerifyUser($mail,$password)
	{
        $uri=$this->client."VerifyUser";
        $parameters='{
	"mail":"'.$mail.'",
	 "password":"'.$password.'"
	 }';
        $r = \Httpful\Request::post($uri)
            ->sendsJson()
            ->body($parameters)
            ->send();
        return $r;
    }
	

	public function GetUserFriends($mail)
	{
        $uri=$this->client."GetUserFriends/".$mail;
        $r = \Httpful\Request::get($uri)->sendIt();
        return $r;
    }
	
	public function GetPlayerInfo($mail)
	{
        $uri=$this->client."GetPlayerInfo/".$mail;
        $r = \Httpful\Request::get($uri)->sendIt();
        return $r;
    }
	
	public function GetCoachInfo($mail)
	{
        $uri=$this->client."GetCoachInfo/".$mail;
        $r = \Httpful\Request::get($uri)->sendIt();
        return $r;
    }
	
	public function GetBusinessInfo($mail)
	{
        $uri=$this->client."GetBusinessInfo/".$mail;
        $r = \Httpful\Request::get($uri)->sendIt();
        return $r;
    }


	public function GetNotifications($mail)
	{
        $uri=$this->client."GetNotifications/".$mail;
        $r = \Httpful\Request::get($uri)->sendIt();
        return $r;
    }

	
	public function GetSports()
    {

        $uri=$this->client."GetSports/";
        $r = \Httpful\Request::get($uri)->sendIt();
        return $r;
	}   

	
	public function GetCities($country)
	{
        $uri=$this->client." GetCities/".$country;
        $r = \Httpful\Request::get($uri)->sendIt();
        return $r;
        
    }
}
